package cn.edu.xmu.oomall.wechatpay.mapper;

import cn.edu.xmu.oomall.wechatpay.model.po.WeChatPayTransactionPo;
import cn.edu.xmu.oomall.wechatpay.model.po.WeChatPayTransactionPoExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WeChatPayTransactionPoMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @Delete({
        "delete from wechatpay_transaction",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @Insert({
        "insert into wechatpay_transaction (`out_trade_no`, `trade_state`, ",
        "`total`, `payer_total`, ",
        "`success_time`)",
        "values (#{outTradeNo,jdbcType=VARCHAR}, #{tradeState,jdbcType=VARCHAR}, ",
        "#{total,jdbcType=INTEGER}, #{payerTotal,jdbcType=INTEGER}, ",
        "#{successTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(WeChatPayTransactionPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @InsertProvider(type=WeChatPayTransactionPoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(WeChatPayTransactionPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @SelectProvider(type=WeChatPayTransactionPoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="trade_state", property="tradeState", jdbcType=JdbcType.VARCHAR),
        @Result(column="total", property="total", jdbcType=JdbcType.INTEGER),
        @Result(column="payer_total", property="payerTotal", jdbcType=JdbcType.INTEGER),
        @Result(column="success_time", property="successTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<WeChatPayTransactionPo> selectByExample(WeChatPayTransactionPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "`id`, `out_trade_no`, `trade_state`, `total`, `payer_total`, `success_time`",
        "from wechatpay_transaction",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="out_trade_no", property="outTradeNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="trade_state", property="tradeState", jdbcType=JdbcType.VARCHAR),
        @Result(column="total", property="total", jdbcType=JdbcType.INTEGER),
        @Result(column="payer_total", property="payerTotal", jdbcType=JdbcType.INTEGER),
        @Result(column="success_time", property="successTime", jdbcType=JdbcType.TIMESTAMP)
    })
    WeChatPayTransactionPo selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @UpdateProvider(type=WeChatPayTransactionPoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") WeChatPayTransactionPo row, @Param("example") WeChatPayTransactionPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @UpdateProvider(type=WeChatPayTransactionPoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") WeChatPayTransactionPo row, @Param("example") WeChatPayTransactionPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @UpdateProvider(type=WeChatPayTransactionPoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WeChatPayTransactionPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table wechatpay_transaction
     *
     * @mbg.generated
     */
    @Update({
        "update wechatpay_transaction",
        "set `out_trade_no` = #{outTradeNo,jdbcType=VARCHAR},",
          "`trade_state` = #{tradeState,jdbcType=VARCHAR},",
          "`total` = #{total,jdbcType=INTEGER},",
          "`payer_total` = #{payerTotal,jdbcType=INTEGER},",
          "`success_time` = #{successTime,jdbcType=TIMESTAMP}",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WeChatPayTransactionPo row);
}